home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / New System Software Extensions / QuickDraw™ GX v1.0ß2 / Interfaces & Libraries / interfaces / shape controls library.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-29  |  4.2 KB  |  73 lines  |  [TEXT/MPS ]

  1. /* gxShape controls library:
  2.     library to allow the user to manipulate (gxTransform) a set of shapes
  3.     by Dave Good and Jeff Kreegar
  4.     Copyright 1991 - 1992 Apple Computer, Inc.  All rights reserved.    */
  5.  
  6. #ifndef shapeControlsLibraryIncludes
  7.     #define shapeControlsLibraryIncludes
  8.  
  9.     #include "graphics types.h"
  10.  
  11. /*
  12. |   General Information:
  13. |
  14. |   • The items gxShape passed in is used directly by the gxShape controls library; the application may modify or
  15. |      look at it at any time. Note that if the application removes or adds a sub-gxShape (or changes a sub-gxShape
  16. |      in any way) then it needs to call InvalidShapeControlShape on the sub-gxShape.
  17. |
  18. |   • The foreground and background shapes are also used directly by the gxShape controls library and therefore
  19. |      can be modified at any time (and also must be invalidated). The background gxShape appears underneath all
  20. |      the items and the foreground gxShape appears above all the items, but below the control handles for the
  21. |      current selection.
  22. |
  23. |   • The foreground and background shapes will both be modified slightly to draw to the same list of viewPorts
  24. |      that the items picture goes to. Other than this, they will not be changed.
  25. |
  26. |   • GetShapeControlSelection and SetShapeControlSelection do NOT work directly with the selection picture
  27. |      inside the gxShape control; instead GetShapeControlSelection returns a completely new picture that contains
  28. |      all the sub-shapes of the item picture that are selected. The application must then dispose of this returned
  29. |      picture when it is through with it. SetShapeControlSelection will select all the sub-shapes of the items
  30. |      picture contained by shapesToSelect. The application may then dispose of this shapesToSelect picture. The
  31. |      shapesToSelect parameter may be a single sub-gxShape instead of a picture, but it must always be contained
  32. |      by the items picture.
  33. |
  34. |   • GetShapeControlSelectionHandles returns a copy of the gxShape that is drawn as the selection’s handles.
  35. |
  36. |   • SendEventToShapeControl returns true if it handled the event and false if it didn’t. The events handled are:
  37. |       * keyDown: delete removes the item
  38. |       * mouseDown: in a destination gxViewPort for the items picture, the selection will be tracked; any other
  39. |          mouse event will return false.
  40. |
  41. |   • InvalidateShapeControlShape does NOT require that invalidShape be a member of the items picture for the
  42. |      gxShape control. However, if invalidShape is a member and it is selected, then the control handles will be
  43. |      added to the invalid area also. An application should use this call when invalidating a picture containly
  44. |      several widely separated disjoint areas; it should probably use InvalidateShapeControlRectangle to invalidate
  45. |      other types of shapes.
  46. |
  47. |   • UpdateShapeControl redraws all the invalid areas that have been recorded by calls to InvalidateShapeControlShape
  48. |      and InvalidateShapeControlRectangle.
  49. |
  50. |   • The gxShape controls library will try to allocate an offscreen buffer for each of the viewPorts that the items
  51. |      picture draws into. If this buffer is allocated, then the manipulation of the sub-objects will be flicker-free.
  52. |      If, on the other hand, there is not enough memory to allocate this buffer, then the gxShape controls library
  53. |      will still work, but the objects will flicker quite a bit as they are manipulated.
  54. */
  55.  
  56.     typedef struct shapeControlRecord **shapeControl;
  57.  
  58.     shapeControl NewShapeControl(gxShape items, gxShape background, gxShape foreground);
  59.     void DisposeShapeControl(shapeControl target);
  60.  
  61.     gxShape GetShapeControlSelection(const shapeControl source);
  62.     void SetShapeControlsSelection(shapeControl target, gxShape shapesToSelect, boolean bringToFront, boolean replaceSelection);
  63.     gxShape GetShapeControlSelectionHandles(const shapeControl source);
  64.  
  65.     boolean SendEventToShapeControl(shapeControl target, EventRecord *event);
  66.  
  67.     void InvalidateShapeControlShape(shapeControl target, gxShape invalidShape);
  68.     void InvalidateShapeControlRectangle(shapeControl target, gxRectangle *bounds);
  69.  
  70.     void UpdateShapeControl(shapeControl target);
  71.  
  72. #endif  /* shapeControlsLibraryIncludes */
  73.